import { http } from "@/utils/http";

export type UserData = {
  username: string,
  password: string,
  imageCode?: string,
  imageGuid?: number
};

type Result = {
  Code: number;
  Content: Array<any>;
  Message: string;
};

/** 登录 */
export const getLogin = (data?: UserData) => {
  const user: UserData = {
    username: data.username,
    password: data.password
  }
  return http.request("post", "/api/SignIn", { data: user }, { headers: { 'X-VGuid': data.imageGuid, 'X-VCode': data.imageCode } });
};

// 登录用户菜单权限
export const getMenuTreeList = () => {
  return http.request<Result>("get", "/api/Menu/MenuTreeList", {});
};

export const GetLogin = () => {
  return http.request<any>("post", "/api/GetLogin", {});
};

// 修改密码
export const PasswordReset = (params: any) => {
  return http.request<any>("post", "/api/User/Password/Reset", {params});
};

// 重置密码
export const ResetPassword = (params: any) => {
  return http.request<any>("post", `/api/User/Password/ResetPassword/${params.userId}`, {params});
};
